<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>libnetconf: Miscelaneous</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../libnetconf-logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">libnetconf
   &#160;<span id="projectnumber">0.10.0-146_trunk</span>
   </div>
   <div id="projectbrief">NETCONF Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d8/d0b/misc.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Miscelaneous </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="misc-datetime"></a>
Date and Time</h1>
<p>Various YANG data models uses YANG date-and-time type for representation of dates and times. The type is defined in ietf-yang-types module that comes from <a href="http://tools.ietf.org/html/rfc6021" title="RFC 6021">RFC 6021</a>. The date-and-time type is, for example, used in all NETCONF event notifications.</p>
<p>The date-and-time format examples: </p>
<div class="fragment"><div class="line">2014-06-05T12:19:58Z</div>
<div class="line">2014-06-05T14:19:58+02:00</div>
</div><!-- fragment --><p>libnetconf provides two functions to handle timestamps:</p>
<ul>
<li><a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga4dfd796fda30d3ad8588b4c30c4c1583" title="Transform given string in RFC 3339 compliant format to the time_t (seconds since the epoch) accepted ...">nc_datetime2time()</a> to convert YANG date-and-time value to ISO C time_t data type representing the time as the number of seconds since Epoch (1970-01-01 00:00:00 +0000 UTC). This data type is used by various standard functions such as localtime() or ctime().</li>
<li><a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga90a44b60b04512fd0a3507ab35a1ccc4" title="Transform given time_t (seconds since the epoch) into the RFC 3339 format accepted by NETCONF functio...">nc_time2datetime()</a> is a reverse function to the previous one. Optionally, it accepts specification of the timezone in which the resulting date-and-time value will be returned.</li>
</ul>
<h1><a class="anchor" id="misc-errors"></a>
NETCONF Errors Handling</h1>
<p>NETCONF protocol specifications (<a href="http://tools.ietf.org/html/rfc6241" title="RFC 6241">RFC 6241</a>) defines list of errors that can be returned by the server. libnetconf provides a set of functions that server to create, manipulate and process NETCONF errors.</p>
<p>NETCONF error is represented by <code>struct nc_err</code>. Specifying one of the <a class="el" href="../../da/d41/error_8h.html#a170ed93037b65394a05e074400848eb2">basic errors</a>, a new error structure can be created by calling the <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga057524ba5256c428b6bf88710f000e0c" title="Create a new error description structure. ">nc_err_new()</a> function. If the caller want to change a <a class="el" href="../../d3/d7a/netconf_8h.html#a39c5f77f5cf9108a27e7a65f3b2ba73d">specific attribute</a>, the <a class="el" href="../../d3/d35/group__gen_a_p_i.html#gab28d881eeebd79d485391ae1ffc97299" title="Set selected parameter of the NETCONF error structure to the specified value. ">nc_err_set()</a> function can be used. To get the value of the <a class="el" href="../../d3/d7a/netconf_8h.html#a39c5f77f5cf9108a27e7a65f3b2ba73d">specific error attribute</a>, there is <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga3d7714f1f56ac7203a80c61aea4344f8" title="Get value of the specified parameter of the NETCONF error structure. ">nc_err_get()</a> function. If the caller want to create a copy of some existing error structure, <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga316faef1140f1b48a2ed1de6d84d2bef" title="Duplicate an error description structure. ">nc_err_dup()</a> can be used. And finally to free all allocated resources, the <a class="el" href="../../d3/d35/group__gen_a_p_i.html#gac4bd51febe24b517d1952d1c1d8f6b07" title="Free NETCONF error structure. ">nc_err_free()</a> is available.</p>
<p>To create &lt;rpc-error&gt; reply, the application is supposed to use <a class="el" href="../../d0/de2/group__reply.html#ga12fd89263289491b84398279e0e449fd" title="Create rpc-reply response with &lt;rpc-error&gt; content. ">nc_reply_error()</a> and <a class="el" href="../../d0/de2/group__reply.html#gafb04a6695650d05a07b571ac1410a681" title="Add another error description into the existing rpc-reply with &lt;rpc-error&gt; content. ">nc_reply_error_add()</a> to add another error structure to the reply.</p>
<p>On the client side, &lt;rpc-error&gt; replies can be handled manually as any other &lt;rpc-reply&gt; recognizing its type using <a class="el" href="../../d0/de2/group__reply.html#gab12cdef82337060c425348dada7fe983" title="Get the type of the rpc-reply message. ">nc_reply_get_type()</a> and then by getting the error message via <a class="el" href="../../d0/de2/group__reply.html#ga121d66d8f7437d87a995b82187e7e7ff" title="Get error-message from the server&#39;s &lt;rpc-error&gt; reply. ">nc_reply_get_errormsg()</a> and parsing its content manually. The other, recomended, way how to handle incoming &lt;rpc-error&gt; replies is to specify the callback function via <a class="el" href="../../d0/de2/group__reply.html#ga771a110143440bcd3b7d4c0e98388e80" title="Set a callback function to process (e.g. print) NETCONF &lt;rpc-error&gt; message items.If the func parameter is NULL, the callback is set back to the default (no) function. ">nc_callback_error_reply()</a>. The callback is automatically invoked to process (e.g. print) &lt;rpc-error&gt; message. In this case, all NETCONF error attributes are parsed and passed to the callback function.</p>
<h1><a class="anchor" id="misc-logging"></a>
Logging Messages</h1>
<p>libnetconf provides information about the data processing on several <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga921d994eb69a9efd93ef85cf4a6cd060">verbose levels</a>. However, by default there is no printing routine, so no message from libnetconf appears until the printing callback is specified using <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga806dfa9c27d2b8076bae21bcd549cce7" title="Set a callback function for printing libnetconf&#39;s messages.If the func parameter is NULL...">nc_callback_print()</a> function. Application is able to set (and change) the current <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga921d994eb69a9efd93ef85cf4a6cd060">verbose levels</a> via the <a class="el" href="../../d3/d35/group__gen_a_p_i.html#gadd8fd7b3bb2e7cba580c9a4229fe02d7" title="Set libnetconf&#39;s verbosity level. ">nc_verbosity()</a> function.</p>
<p>Mainly for <a class="el" href="../../d9/d25/transapi.html">transAPI</a> modules, there is a set of functions to access message printing callback outside the library:</p>
<ul>
<li><a class="el" href="../../d3/d35/group__gen_a_p_i.html#gabd4e3697f3a1fe6b5853e692ad20c2bb" title="Function for logging error messages. ">nc_verb_error()</a></li>
<li><a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga943a7c859f20bb1278964a7424762d8e" title="Function for logging warning messages. ">nc_verb_warning()</a></li>
<li><a class="el" href="../../d3/d35/group__gen_a_p_i.html#gae4f0d22fb274269c0259497abb702f5d" title="Function for logging verbose messages. ">nc_verb_verbose()</a> </li>
</ul>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../da/d1b/usage.html">Using libnetconf</a></li>
    <li class="footer">Generated on Fri Apr 15 2016 09:20:09 for libnetconf by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
